import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'url'
import vue from '@vitejs/plugin-vue'
const port = process.env.port || process.env.npm_config_port || 80
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server: {
    port: 81,
    strictPort: false,
    host: '0.0.0.0',
    open: true,
    proxy: {
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      '/dev-api': {
        target: `http://localhost:8080`,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/dev-api/, '')
      },
    },
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
})

